package {{packageName}}.server.test.service

import com.firefly.kotlin.ext.context.getBean
import {{packageName}}.api.model.entity.Project
import {{packageName}}.api.service.ProjectService
import {{packageName}}.server.test.common.AbstractServerTest
import {{packageName}}.server.test.common.Context.ctx
import kotlinx.coroutines.runBlocking
import org.junit.Test
import java.util.*
import kotlin.test.assertEquals

/**
 * @author Pengtao Qiu
 */
class TestProjectService : AbstractServerTest() {

    private val projectService: ProjectService = ctx.getBean()

    @Test
    fun test() = runBlocking {
        val now = Date()
        val id = projectService.insert(Project(null, now, now, "firefly kt web seed project 1.0.0"))
        assertEquals(1L, id)

        val project = projectService.get(id)
        assertEquals("firefly kt web seed project 1.0.0", project.name)
        println(project)
    }

}